package com.cxy.datawarehouse.biz;

import com.cxy.datawarehouse.entity.StandardCode;
import com.cxy.datawarehouse.service.StandardCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Component
@Slf4j
public class StandardCodeBiz {
    @Resource
    StandardCodeService service;

    public List<StandardCode> list(){
        return service.list();
    }

    public StandardCode getById(Long id){
        return service.getById(id);
    }

    public List<StandardCode> getByTypeId(Long id){
        return service.getByTypeId(id);
    }

    public void update(StandardCode standardCode){
        service.update(standardCode);
    }

    public void create(StandardCode standardCode){
        standardCode.setStatus((long) 1);
        standardCode.setCreateTime(LocalDateTime.now());
        standardCode.setUpdateTime(LocalDateTime.now());
        standardCode.setConfigCodeNumber((long) 0);
        service.create(standardCode);
    }

    public void deleteById(Long id){
        service.deleteById(id);
    }

    public void stopById(Long id){
        service.stopById(id);
    }

    public void openById(Long id){
        service.openById(id);
    }
}
